<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

    <div id="test_id">

    </div>


    <script src="jquery.min.js"></script>
    <script>
        $(function () {
            loadcontent(0,0);
        });
        function loadcontent(i,j) {


            if(i<1000 && j<5000){


                var len = (i+"").length;
                var num = 0;
                if(len==1){
                    num = "00"+i;
                }else if (len==2){
                    num = "0"+i;
                }else if (len==3){
                    num = ""+i;
                }

                var targetlink = "http://zhongyi.shufaji.com/zygj/"+num+"/"+j+".htm";
                console.log(targetlink);
                $("#test_id").load(targetlink,function (msg,status) {
                    setTimeout(function () {

                        var test_text = $.trim($("#test_id").text());

                        if(test_text!="" && status=="success"){

                            var title = "";
                            var title_content = "";
                            var title_htmlcontent = "";

                            $("td").each(function (_index,_this) {
                                var size = $(_this).css("font-size");
                                var lineheight = $(_this).css("line-height");
                                if(size=="20px" && lineheight=="56px"){
                                    var content = $.trim($(_this).text());
                                    title = content;
                                }else if(size=="16px" && lineheight=="38px"){
                                    var content = $.trim($(_this).text());
                                    var htmlcontent = $.trim($(_this).html());
                                    title_content = content;
                                    title_htmlcontent = htmlcontent;
                                    if(title!="" && title_content!="" && title_htmlcontent!=""){

                                        $.ajax({
                                            url:"../../hoaservice_leizhuren/zygj/addcontent",
                                            data:{
                                                num:num,
                                                title:title,
                                                title_content:title_content,
                                                title_htmlcontent:title_htmlcontent
                                            },
                                            cache:false,
                                            async:true,
                                            success:function (msg) {
                                                console.log(msg);
                                            }

                                        });





                                    }
                                }
                            });

                        }else {
                            //alert(2);
                            j = 4999;





                        }

                        var ix = i;
                        var jx = j;
                        if(j>=4999){
                            ix = parseInt(i)+1;
                            jx = 0;
                        }else {
                            jx = parseInt(j)+1;
                        }
                        setTimeout(function () {
                            console.log("**"+ix+"**"+jx)
                            loadcontent(ix,jx);
                        },1000);




                    },800);
                });



            }





        }

    </script>

</body>
</html>